package com.mwyq.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.abel533.echarts.Option;
import com.github.abel533.echarts.axis.CategoryAxis;
import com.github.abel533.echarts.axis.ValueAxis;
import com.github.abel533.echarts.code.Trigger;
import com.github.abel533.echarts.series.Bar;
import com.github.abel533.echarts.series.Pie;
import com.mwyq.dao.EntityMapper;
import com.mwyq.model.EntityExample;

@Service
public class EntityService {

	@Autowired
	private EntityMapper entityMapper;
	
	
	/**
	 * 获取首页展示数据
	 * */
	public Map<String, Integer> getIndexEntity(){  
	    
		Map<String, Integer> map = new HashMap<String,Integer>();
		
		EntityExample examplePer = new EntityExample();
	    EntityExample.Criteria criteriaPer = examplePer.createCriteria();
	    criteriaPer.andEntity_typeEqualTo("PER");
	    int perNum = entityMapper.countByExample(examplePer);
	    map.put("per", perNum);
	    
	    
	    EntityExample exampleLoc = new EntityExample();
	    EntityExample.Criteria criteriaLoc = exampleLoc.createCriteria();
	    criteriaLoc.andEntity_typeEqualTo("LOC");
	    int locNum = entityMapper.countByExample(exampleLoc);
	    map.put("loc", locNum);
	    EntityExample exampleOrg = new EntityExample();
	    EntityExample.Criteria criteria = exampleOrg.createCriteria();
	    criteria.andEntity_typeEqualTo("ORG");
	    int orgNum = entityMapper.countByExample(exampleOrg);
	    map.put("org", orgNum);
	    System.out.println("perNum:"+perNum+" locNum:"+locNum +" orgNum:"+orgNum);
	    //创建Option  
	    
	    return map;  
	}  
	
}
